Release 10.1A: OpenEdge Development:
Programming Interfaces


Shared library parameter data types

For shared library parameter definitions, Progress provides a special set of data types to match the standard C data types used in shared library calling sequences. These are the only data types you can specify for the AS datatype option in shared library parameter definitions:

CHARACTER and MEMPTR are standard Progress variable data types available for other uses. You can only use the remaining listed data types for shared library parameter definitions.

The MEMPTR data type specifies a pointer to a region of memory. It lets you define and pass C-compatible structures to shared library routines. For more information on using the MEMPTR data type, see the "Using structure parameters" section.

Data type compatibilities

For each parameter definition, you must specify a data type that is compatible with the standard C data type of the corresponding DLL routine parameter. Many data types referenced by DLL routines have the same memory size and usage.

Table 12–2 lists each supported memory size and usage, examples of corresponding C data types, and the Progress DLL parameter data type you must use for each one.

Table 12–2: C and DLL parameter data type compatibilities
Example C
data type
DLL parameter
data type
Data type size
and usage
char 
BYTE 
8-bit unsigned integer
short 
SHORT 
16-bit signed integer
unsigned short 
UNSIGNED-SHORT 
16-bit unsigned integer
long, int1 
LONG2  
32-bit signed integer
float 
FLOAT 
4-byte floating point
double 
DOUBLE 
8-byte floating point
char* 
CHARACTER 
Address (usually 32 bits)
c-data-type3 
HANDLE TO 
parameter-data-type3  
Address (usually 32 bits)
char*, output-pointer (which can be char**, short**, and so on), or a pointer to a structure.
MEMPTR 
Address (usually 32 bits)
1The C data type int generally specifies a size that depends on the operating system.
2To pass a NULL pointer value to a DLL routine, pass 0 using a LONG parameter. Do not use a null MEMPTR variable to pass a NULL value. If this conflicts with another way to call the DLL routine, specify a second declaration for the same routine using the ORDINAL option of the PROCEDURE statement.
3You can use the HANDLE TO option to specify a pointer to a scalar type. Therefore, you can use the HANDLE TO option with the parameter data types (that is, BYTE, SHORT, UNSIGNED-SHORT, LONG, FLOAT, and DOUBLE) in order to specify a pointer to the respective C data types (that is, char, short, unsigned short, long, int, float, and double). For CHARACTER and MEMPTR parameters, it is redundant because this data type is always passed using a pointer (char*).

To indicate that the DLL or UNIX shared library parameter is a pointer to a value rather than the value itself, use the HANDLE option. The HANDLE option is required when the DLL routine expects a pointer to the value. Note that the CHARACTER data type implies the HANDLE option, whether or not you specify it. The TO keyword aids readability but has no meaning.

For more information on C data types, see the documentation for the operating system(s) on which your applications will run.

Other data type options

For shared library parameters that pass pointers to scalar values (for example, SHORT, DOUBLE, etc.), Progress provides the HANDLE option. You must use this option for INPUT parameters that require pointers to scalar values instead of the values themselves. Although Progress automatically passes pointers for OUTPUT and INPUT-OUTPUT parameters, the HANDLE option is recommended for clarity.

If you use the LIKE option to specify the data type of a parameter definition, field might only be a database field defined as CHARACTER or a Progress variable defined as CHARACTER or MEMPTR.

Note: Progress does not support database fields defined as MEMPTR.


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095